-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yarn workspaces + nested pulumi project + local package reference = "Could not include required dependency" #2661
Comments
In addition to the index.ts/files-in-root workarounds, if I add a dependency they are not getting deployed in to the lambda. To workaround that, I have to use |
Is there any support for Could not include required dependency '@outmind/lambdas' in '/.../outmind-app/aws-architecture'.
Could not include required dependency '@pulumi/pulumi' in '/.../outmind-app/aws-architecture'.
Could not include required dependency '@pulumi/aws' in '/.../outmind-app/aws-architecture'.
Could not include required dependency '@pulumi/awsx' in '/.../outmind-app/aws-architecture'. All my packages are named Thank you for any support. Our company is really excited about this project but we can't manage to make it work in our environment. |
Following this as well, we've had in other solutions to really work hard to get around this. Having first |
I am facing the same issue with lerna/yarn workspaces. The error message is also misleading imo: I do not think we want to include |
I think you should just go to packages/cloud and run |
Looked into this a little today. It appears the issue is that we use https://github.com/npm/read-package-tree to read the local https://github.com/npm/read-package-tree/blob/master/rpt.js#L109 We will likely either need to maintain a fork of |
Related: #4349 |
Facing the same issue here in a yarn workspaces + lerna monorepo. I have a |
FWIW this is my solution. I have created a pulumi.js node script which runs tsc -b and also added dynamoDB locking. https://gist.github.com/JakeGinnivan/a8a9487b427755f267ea6bf7ec42699f |
I just make sure I have a single pulumi project for my mono repo and use webpack to bundle lambdas and code which pulumi uploads |
I had success by adding into my pulumi files package.json: "workspaces": {
"nohoist": [
"@pulumi/aws"
]
}, See here: https://classic.yarnpkg.com/blog/2018/02/15/nohoist/ |
@vvo this only works for Yarn v1. This option is gone for Yarn v2. |
Has there been any movement on this issue? As it stands it does not seem like pulumi works with yarn workspaces. |
@JakeGinnivan do you have a working example of how you do that? |
@DanNeish I've now switched my approach and am building out an NX plugin to make it easy to use Pulumi in an nx.dev mono repo. I am now trying to create a small pulumi program for each service in the mono repo, then working towards being able to |
So yarn recently added the nmHoistingLimits option, this ensures that the workspace has a local By adding the following to the package.json in the workspace that is deploying the inline lamdas you can enable this per-workspace:
The problem I'm facing now is that the way Yarn does this for all local workspaces is to add a symlink.
When Pulumi tries to bundle these it gets confused and thinks this is a file. So throws the following error:
So I think if we can get the asset library to handle symlinks, this should just work? p.s. I'm happy to do this if someone points me in the right direction. Related, #2980. |
I use Yarn workspaces to manage a monorepo containing dozen of pulumi projects and a few library packages. The key to make this work in my experience is to:
That said, this is a workaround. Making Pulumi work well with Yarn's package hoisting would be awesome! |
For Yarn >=v2 you can do this ^^ in the
Unfortunately, this doesn't work for us as a |
For everyone using yarn 2+ workspaces once #8215 gets into a release, you can do the package.json configuration in my above comment and it should all just work. |
Two issues: 1. Pulumi can't bundle dependencies from node_modules in the project root. See pulumi/pulumi#2661 Creating a symlink from node_modules -> infra/node_modules works, but that's pretty hokey. 2. When executing the function, I get "The security token included in the request is invalid." So something still isn't configured right.
Two issues: 1. Pulumi can't bundle dependencies from node_modules in the project root. See pulumi/pulumi#2661 Creating a symlink from node_modules -> infra/node_modules works, but that's pretty hokey. 2. When executing the function, I get "The security token included in the request is invalid." So something still isn't configured right.
Two issues: 1. Pulumi can't bundle dependencies from node_modules in the project root. See pulumi/pulumi#2661 Creating a symlink from node_modules -> infra/node_modules works, but that's pretty hokey. 2. When executing the function, I get "The security token included in the request is invalid." So something still isn't configured right.
Two issues: 1. Pulumi can't bundle dependencies from node_modules in the project root. See pulumi/pulumi#2661 Creating a symlink from node_modules -> infra/node_modules works, but that's pretty hokey. 2. When executing the function, I get "The security token included in the request is invalid." So something still isn't configured right.
Two issues: 1. Pulumi can't bundle dependencies from node_modules in the project root. See pulumi/pulumi#2661 Creating a symlink from node_modules -> infra/node_modules works, but that's pretty hokey. 2. When executing the function, I get "The security token included in the request is invalid." So something still isn't configured right.
Two issues: 1. Pulumi can't bundle dependencies from node_modules in the project root. See pulumi/pulumi#2661 Creating a symlink from node_modules -> infra/node_modules works, but that's pretty hokey. 2. Vitest fails with the error below. I've filed a bug report with Pulumi (# 10480) Error: Could not find property info for real property on object: sdk ❯ node_modules/@pulumi/runtime/closure/createClosure.ts:1103:27 ❯ fulfilled node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:18:58
Two issues: 1. Pulumi can't bundle dependencies from node_modules in the project root. See pulumi/pulumi#2661 Creating a symlink from node_modules -> infra/node_modules works, but that's pretty hokey. 2. Vitest fails with the error below. I've filed a bug report with Pulumi (# 10480) Error: Could not find property info for real property on object: sdk ❯ node_modules/@pulumi/runtime/closure/createClosure.ts:1103:27 ❯ fulfilled node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:18:58
Two issues: 1. Pulumi can't bundle dependencies from node_modules in the project root. See pulumi/pulumi#2661 Creating a symlink from node_modules -> infra/node_modules works, but that's pretty hokey. 2. Vitest fails with the error below. I've filed a bug report with Pulumi (# 10480) Error: Could not find property info for real property on object: sdk ❯ node_modules/@pulumi/runtime/closure/createClosure.ts:1103:27 ❯ fulfilled node_modules/@pulumi/pulumi/runtime/closure/createClosure.js:18:58
is computeCodePaths relevant to this problem? |
I stumbled onto this issue trying to get mixins working with pnpm, nx and esbuild Here's what didn't work for me:
Here's what does work for me:
|
# Description When we compute the code paths for function serialisation, we are not handling yarn/npm workspace setups where the node_modules might be in a different directory. Fixes #15436 Fixes #2661 Fixes #7168 Fixes #3013 ## Checklist - [x] I have run `make tidy` to update any new dependencies - [x] I have run `make lint` to verify my code passes the lint check - [x] I have formatted my code using `gofumpt` <!--- Please provide details if the checkbox below is to be left unchecked. --> - [x] I have added tests that prove my fix is effective or that my feature works <!--- User-facing changes require a CHANGELOG entry. --> - [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change <!-- If the change(s) in this PR is a modification of an existing call to the Pulumi Cloud, then the service should honor older versions of the CLI where this change would not exist. You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add it to the service. --> - [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version <!-- @pulumi employees: If yes, you must submit corresponding changes in the service repo. -->
Here's a gutted project structure that matches what I'm trying to get working:
https://github.com/brandonbloom/pulumi-workspaces-repro
In short, there are three packages: "core", "local", and "cloud". The bulk of the code is implemented in "core" and local development primarily operates via
ts-node-dev
running "local/index.ts", which imports "core". Then, there is a "cloud" package, which hosts the Pulumi bits, which also reuses core. Yarn creates a single top-levelnode_modules
directory, and attempting to import core produces this error:Could not include required dependency 'example-core'
As a workaround, I've added an
index.ts
file that doesrequire('./packages/cloud')
in the root and moved the Pulumi*.yaml
files to the root as well. Nowpulumi up
works if you omit-C packages/cloud
, but I'd like to keep the Pulumi files contained to their package.The text was updated successfully, but these errors were encountered: